package com.wanmait.recruit.service.impl;

import com.github.pagehelper.PageInfo;
import com.wanmait.recruit.pojo.Resume;
import com.wanmait.recruit.service.PositionDesiredService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.wanmait.recruit.mapper.PositionDesiredMapper;
import com.wanmait.recruit.pojo.PositionDesired;
import org.springframework.transaction.annotation.Transactional;

@Service("positionDesiredService")
@Transactional(rollbackFor = Exception.class)
public class PositionDesiredServiceImpl implements PositionDesiredService {

    @Resource
    private PositionDesiredMapper positionDesiredMapper;

    public int deleteByPrimaryKey(Integer id){
        return positionDesiredMapper.deleteByPrimaryKey(id);
    }

    public void insert(PositionDesired record){
        positionDesiredMapper.insert(record);
    }

    @Override
    public void delete(PositionDesired object) {

    }

    @Override
    public void update(PositionDesired object) {
        positionDesiredMapper.updateByPrimaryKey(object);
    }

    @Override
    public PageInfo<PositionDesired> search(int pageNum, int pageSize) {
        return null;
    }

    public int insertSelective(PositionDesired record){
        return positionDesiredMapper.insertSelective(record);
    }

    public PositionDesired selectByPrimaryKey(Integer id){
        return positionDesiredMapper.selectByPrimaryKey(id);
    }

    public int updateByPrimaryKeySelective(PositionDesired record){
        return positionDesiredMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(PositionDesired record){
        return positionDesiredMapper.updateByPrimaryKey(record);
    }

    @Override
    public PositionDesired findByResume(Resume resume) {
        return positionDesiredMapper.findByResumeId(resume.getId());
    }

    @Override
    public boolean findIsPositionDesired(Integer resumeId) {
        PositionDesired positionDesired = positionDesiredMapper.selectByResumeId(resumeId);
        if (positionDesired!=null){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public PositionDesired findPositionDesired(Integer resumeId) {
        return positionDesiredMapper.selectByResumeId(resumeId);
    }

    @Override
    public void delEducationExp(Integer id) {
        positionDesiredMapper.updateEducationExpDel(id);
    }
}
